import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace SysTimeThresholdApi {
  /** 系统时间阈值配置信息 */
  export interface SysTimeThreshold {
    id: number; // 编号
    ruleCode?: string; // 规则编码
    ruleAlias?: string; // 别名
    threshold?: number; // 时间阈值，分钟
    ruleDesc: string; // 规则描述
    status?: number; // 状态，0关闭1开启
  }
}

/** 查询系统时间阈值配置分页 */
export function getSysTimeThresholdPage(params: PageParam) {
  return requestClient.get<PageResult<SysTimeThresholdApi.SysTimeThreshold>>('/moxi/sys-time-threshold/page', { params });
}

/** 查询系统时间阈值配置详情 */
export function getSysTimeThreshold(id: number) {
  return requestClient.get<SysTimeThresholdApi.SysTimeThreshold>(`/moxi/sys-time-threshold/get?id=${id}`);
}

/** 新增系统时间阈值配置 */
export function createSysTimeThreshold(data: SysTimeThresholdApi.SysTimeThreshold) {
  return requestClient.post('/moxi/sys-time-threshold/create', data);
}

/** 修改系统时间阈值配置 */
export function updateSysTimeThreshold(data: SysTimeThresholdApi.SysTimeThreshold) {
  return requestClient.put('/moxi/sys-time-threshold/update', data);
}

/** 删除系统时间阈值配置 */
export function deleteSysTimeThreshold(id: number) {
  return requestClient.delete(`/moxi/sys-time-threshold/delete?id=${id}`);
}

/** 批量删除系统时间阈值配置 */
export function deleteSysTimeThresholdList(ids: number[]) {
  return requestClient.delete(`/moxi/sys-time-threshold/delete-list?ids=${ids.join(',')}`)
}

/** 导出系统时间阈值配置 */
export function exportSysTimeThreshold(params: any) {
  return requestClient.download('/moxi/sys-time-threshold/export-excel', params);
}

